<div id="popupX" style="display:none"></div>
<?php if(count($wikiPages)>1) : ?>
<?php foreach($wikiPages as $wikiPage) : ?>
<?php echo $wikiPage->title; ?>
<?php endforeach; ?>
<?php elseif(count($wikiPages)==1 ) : $wikiPage = $wikiPages[0]; ?>
<div style="font-size:0.9em;margin:0px 0px 2px 0px;text-align:right"><?php echo CHtml::ajaxLink(
    Yii::t('site','Zoom'),
    array(
        '/wikiPage/viewPopup',
        'id'=>$wikiPage->id,
        'popup'=>1
    ),
    array(
        'onclick'=>'$("#popupX").show().dialog("open"); return false;',
        'update'=>'#popupX',
    ),
    array(
        'title' => Yii::t('site','Show Online Help Page as popup')
    )
); ?></div>

<div class="onlineHelpPage">
    <?php
        $this->beginWidget('CMarkdown', array('purifyOutput'=>true));
        $content = preg_replace(array("/_ICON_NEW_/","/_ICON_EDIT_/","/_ICON_VIEW_/","/_ICON_DELETE_/"),array(ICON_NEW,ICON_EDIT,ICON_VIEW,ICON_DELETE),$wikiPage->content);
        echo $content;
        $this->endWidget();
    ?>
</div>
<?php else : ?>
<?php echo CHtml::encode(Yii::t('site','No help page found.')); ?>
<?php endif; ?>
<?php if(Yii::app()->user->checkAccess('admin')) : ?>
<?php if(count($wikiPages)==1 ) : ?>
<?php echo CHtml::link(ICON_EDIT,array('/wikiPage/update','id'=>$wikiPage->id),array('title'=>Yii::t('site','Update this Online Help Page'),'target'=>'_blank')); ?>
<?php endif; ?>
<?php echo CHtml::link(ICON_NEW,array('/wikiPage/create','wikiBookId'=>$wikiBookId,'tags'=>'Action_'.$controllerId.'_'.$controllerAction),array('title'=>Yii::t('site','Create a new Online Help Page'),'target'=>'_blank')); ?>
<?php echo CHtml::link(ICON_VIEW,array('/wikiPage/admin','WikiPage[wikiBookId]'=>$wikiBookId),array('title'=>Yii::t('site','Manage Online Help Pages'))); ?>
<?php endif; ?>
